package com.lyy.config;


import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Liangyaoyun
 */
@Configuration
public class SpringDocConfig {
    private final static String TITLE = "我的文档标题";
    private final static String VERSION = "v1.0.1";
    private final static String EMAIL = "798482363@qq.com";
    private final static String NAME = "WXH";
    private final static String URL = "http:/localhost:8080";
    private final static String DESCRIPTION = "<em>我的文档描述</em>";

    /** 通用信息展板 */
    @Bean
    public OpenAPI commonInfo() {
        return new OpenAPI().info(new Info()
                .title(TITLE)
                .description(DESCRIPTION)
                .version(VERSION)
                .contact(new Contact().email(EMAIL).name(NAME).url(URL)));
    }

    /**整合Knife4j必须添加这个@Bean*/
    @Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .setGroup(TITLE)
                .pathsToMatch("/**")
                .build();
    }
}
